#include <iostream>
#include <cstdio>
typedef long long ll;
using namespace std;
ll ex_gcd(ll a, ll b, ll &x, ll&y) {
    if (b==0) {
        x=1;
        y=0;
        return a;
    }
    ll res=ex_gcd(b, a%b, x, y);
    ll tmp=y;
    y=x-a/b*y;
    x=tmp;
    return res;
}
ll cal(int a, int b, int c) {
    ll x, y;
    ll res=ex_gcd(a,b,x,y);
    if (c%res!=0) return -1;
    x*=c/res;
    x=x%b;
    if (x<0) x+=b;
    return x;
}
int main() {
    ll a,b,c,d,l;
    cin>>a>>b>>c>>d>>l;
    if (d==c) {
        cout<<"Impossible"<<endl;
    }
    else {
        int ans=cal(d-c,l,a-b);
        if (ans<0) cout<<"Impossible"<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}
